<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" name="" class="search">
</body>
</html>
<script !src="">
    function debounce(fn, wait = 50) {
        let timer = null;
        return function () {
            if (timer) {
                clearTimeout(timer)
            }
            timer = setTimeout(() => {
                fn();
            }, wait)
        }
    }
    let search = document.querySelector('.search');
    function showValue () {
        console.log(search, search.value)
    }
    search.oninput = debounce(showValue, 1000)
</script>
